"""USERS_LIST = []
for i in range(1, 87):
    result = "由大和老张在一起，第%s天，第%s次想由大" % (i, i,)
    USERS_LIST.append(result)

num_page = len(USERS_LIST)  # 数据总数
one_page = 10
total_page, b = divmod(num_page, one_page)  # 算出总页数
if b>0 :
    total_page +=1#*

num = int(input("请输入页数："))
if num < 1 or num >total_page:#*
    print('输入页码不合法')
else:
    s = (num-1)*10
    e = num*10
    data = USERS_LIST[s:e]
    for i in data:
        print(i)
"""

"""转换进制
v1 = '0b1101'
v2 = int(v1,base=2)
print(v2)
"""
"""面试题
ip = '192.168.12.79'
new_ip = ip.split('.')
result = []
for i in new_ip:
    result.append(bin(int(i)))
for i in result:
    new_i = i.split('b')
    print(new_i)
"""
# v = pow(9,2)次方
# print(v)
# v = [123,5,44,765467,4576,23,2]
# c = v.index(4576,1,6)查找
# print(c)闭包演示
# name = 'alex'
#
#
# def base():
#     print(name)
#
#
# def func():
#     name = 'zky'
#     base()
#
#
# func()
"""验证码
data = []
for i in range(4):
    v = random.randint(65,90)
    v1 = chr(v)
    data.append(v1)
print(''.join(data))
"""
"""进多少出多少
v = [12, 3, 4, 5, 6, 66]
result = map(lambda x: x + 100, v)
print(result)
print(list(result))
"""""
"""过滤
v = [12, 'da', 'asd', 3, 4, 5, 6, 66]
result = filter(lambda x: type(x) == int, v)
print(list(result))
"""
"""求和，乘，拼接
import functools

v = [12, 3, 4, 5, 6, 66]
result = functools.reduce(lambda x, y: x +y, v)
print(result)
"""
"""
import hashlib
USER_LIST = []



def get_md5(data):
    ob = hashlib.md5() 
    ob.update(data.encode('utf-8'))  # 明文
    result = ob.hexdigest()  # 密文
    return result

def users():
    print('请注册')
    while True:
        username=input("请输入用户名:")
        if username.lower()=='n':
            return
        pwd = input('请输入密码:')
        temp={'user':username,'passwd':get_md5(pwd)}
        USER_LIST.append(temp)


users()
print(USER_LIST)
"""
"""密码隐藏
import getpass

pwd = getpass.getpass("请输入密码:")
"""
# 将下面数字转换成二进制，通过二进制的方式拼接起来生成一个新的二进制
"""
IP = '192.168.72.35'
result = IP.split('.')
data = []
new_data = []
num = []
for i in result:
    val = bin(int(i))
    data.append(val)
    res = val.split('0b')
    new_data.append(res)
    for i in range(len(new_data)):
        if len(new_data[i][1]) == 8:
            num.append(new_data[i][1])
        elif len(new_data[i][1]) != 8:
            temp = new_data[i][1] + '0'
            continue
    result = '.'.join(num)

print(result)
"""

"""参数书写规范，及错误纠正
def func(*args,**kwargs):
    print(args,kwargs)


func('a',12,*[123,3456],**{'k1':'123'},k12=1255476)
"""
"""作业题
func_list = []
for i in range(10):
    func_list.append(lambda :i)

v1 = func_list[0]()
v2 = func_list[5]()
print(v1,v2)
"""

""""作业题
def func(num):
    return lambda: print(num)


result = []
for i in range(10):
    f = func(i)
    result.append(f)
print(i)
print(result)
v1 = result[0]()
v2 = result[9]()
print(v1, v2)
"""
"""装饰器
def func(arg):
    def inner():
        print('bedore')
        v = arg()
        print('behind')
        return v
    return inner

@func
def index():
    print('123')
    return 666

print(index())
"""
"""新浪面试
v= [ lambda x:x*i for i in range(10)]
print(v[0](2))
"""

"""
def num():
    return [lambda x: x * i for i in range(4)]


print([m(2)for m in num()])
"""
"""
v2 = [i for i in range(10) if i > 5 ]
print(v2)
"""
"""
def func(arg):
    def inner():
        print('bedore')
        v = arg()
        print('behind')
        return v
    return inner

@func#1.执行func函数并将下面的函数参数传递，相当于func(index)2.将func的返回值重新赋值给下面的函数名。index = func(index)
def index():
    print('123')
    return 666
print(index())
"""


def func(a, b=[]):
    b.append(a)
    return b


l1 = func(1)
l2 = func(2, [11, 22, 33])
l3 = func(3)
print(l1,l2, l3)
